<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <link rel="stylesheet" href="css/css.css">
</head>
<body>
<div id="nuw">
    <div class="nuw_zong">
        <div class="nuw_logo clearfix"></div>
        <div class="nuw_gong_neng">
            <ul>
                <li><a href="#">登录</a></li>
                <li><a href="#">注册</a></li>
                <li><a href="#">个人中心</a></li>
            </ul>
        </div>
    </div>
</div>

<div class="nuw_have">
    <div class="nuw_have_ong">
        <h3>网站登录</h3>
    </div>
    <div class="nuw_have_tow">
        <from actio="" method="" name="">
            <p class="user">
                <label for="user">账号:</label>
                <input id="user" class="text" type="text" value="">
            </p>
            <p class="pass">
                <label for="pass">密码:</label>
                <input id="pass" class="text" type="password" value="">
            </p>
        </from>
    </div>

</div>
</body>
</html>
<script src="js/jquery-1.10.1.js"></script>
<script></script>
<script>
    $(function () {
        $("#nuw ul li:eq(0)").click(function () {
                $(".nuw_have").show();
        })


        $(".nuw_have .nuw_have_ong").bind("mousedown",function (e) {
            var disX = e.clientX - $(this).offset().left;
            var disY = e.clientY - $(this).offset().top;
            $(document).bind("mousemove",function (e) {
                var l = e.clientX - disX;
                var t = e.clientY - disY;
                if(l < 0){
                    l = 0;
                }
                if(l > $(window).width() - $(".nuw_have .nuw_have_ong").outerWidth()){
                    l = $(window).width() - $(".nuw_have .nuw_have_ong").outerWidth();
                }
                if(t > $(window).height() - $(".nuw_have .nuw_have_ong").outerHeight()){
                    t = $(window).height() - $(".nuw_have .nuw_have_ong").outerHeight()
                }
                if(t < 0){
                    t = 0;
                }
                $(".nuw_have").css({
                    left : l,
                    top : t
                })
            })
            $(document).bind("mouseup",function () {
                $(document).unbind("mousemove");
                $(document).unbind("mouseup");
            })

            return false;
        })









    })
</script>


